package com.xinqi.modules.sys.platform.controller.inner;

import com.xinqi.common.base.response.PageInfo;
import com.xinqi.common.base.response.Param;
import com.xinqi.common.base.response.R;
import com.xinqi.modules.sys.platform.dto.req.PlatformQueryDTO;
import com.xinqi.modules.sys.platform.dto.rsp.PlatformResultDTO;
import com.xinqi.modules.sys.platform.service.PlatformService;
import io.swagger.v3.oas.annotations.Hidden;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 系统平台内部控制层
 *
 * @author: linkai
 * @date: 2023/04/01
 */
@Hidden
@RestController
@RequestMapping("/inner/platform")
@RequiredArgsConstructor
public class PlatformInnerController {
    private final PlatformService platformService;

    /**
     * 系统平台-分页
     */
    @GetMapping("/page")
    public R<PageInfo<PlatformResultDTO>> page(Param pageable, PlatformQueryDTO dto) {
        PageInfo<PlatformResultDTO> page = platformService.page(pageable, dto);
        return R.data(page);
    }

    /**
     * 系统平台-详情
     */
    @GetMapping("/{id}")
    public R<PlatformResultDTO> findById(@PathVariable("id") Long id) {
        PlatformResultDTO dto = platformService.findById(id);
        return R.data(dto);
    }
}
